var __extends =
    (this && this.__extends) ||
    (function () {
      var e = function (t, r) {
        return (e =
          Object.setPrototypeOf ||
          ({ __proto__: [] } instanceof Array &&
            function (e, t) {
              e.__proto__ = t;
            }) ||
          function (e, t) {
            for (var r in t)
              Object.prototype.hasOwnProperty.call(t, r) && (e[r] = t[r]);
          })(t, r);
      };
      return function (t, r) {
        function i() {
          this.constructor = t;
        }
        if ("function" != typeof r && null !== r)
          throw new TypeError(
            "Class extends value " + String(r) + " is not a constructor or null"
          );
        e(t, r),
          (t.prototype =
            null === r
              ? Object.create(r)
              : ((i.prototype = r.prototype), new i()));
      };
    })(),
  RepairPropertyView = (function (e) {
    function t() {
      var t = e.call(this) || this;
      return (
        t.btn_xiubukangxing_back.on(Laya.Event.CLICK, t, t.onBackAction),
        t.btn_repairProperty_xiubushuoming.on(
          Laya.Event.CLICK,
          t,
          t.onRepairPropertyAction
        ),
        WebSocketService.addListener({
          caller: t,
          code: 4542,
          method: t.onLoadRepairListData,
        }),
        (t.list_one_repair.selectEnable = !0),
        (t.list_one_repair.renderHandler = new Handler(
          t,
          t.onupdateRepairItemFn
        )),
        (t.list_one_repair.vScrollBarSkin = ""),
        t.list_one_repair.on(Laya.Event.CLICK, t, t.onListRepairPropertyAction),
        (t.list_two_repair.selectEnable = !0),
        (t.list_two_repair.renderHandler = new Handler(
          t,
          t.onupdateRepairItemFn
        )),
        (t.list_two_repair.vScrollBarSkin = ""),
        t.list_two_repair.on(Laya.Event.CLICK, t, t.onListRepairPropertyAction),
        (t.list_three_repair.selectEnable = !0),
        (t.list_three_repair.renderHandler = new Handler(
          t,
          t.onupdateRepairItemFn
        )),
        (t.list_three_repair.vScrollBarSkin = ""),
        t.list_three_repair.on(
          Laya.Event.CLICK,
          t,
          t.onListRepairPropertyAction
        ),
        t
      );
    }
    return (
      __extends(t, e),
      (t.showRepairPropertyView = function (e) {
        return (
          null == this.repairView && (this.repairView = new t()),
          (this.repairView.jsonDict = e),
          (this.repairView.repairData = []),
          (this.repairView.label_xiubu_person.text = e.name + "修补"),
          "zhujiang" == e.type
            ? WebSocketService.send({ c: 4542, d: { cid: 0 } })
            : WebSocketService.send({ c: 4542, d: { cid: e.id } }),
          this.repairView
        );
      }),
      (t.prototype.onRepairPropertyAction = function () {
        var e = CaslnoRulesView.showCaslRuleView("xiubushuoming");
        (e.y = 50), (e.height = 570), Laya.stage.addChild(e);
      }),
      (t.prototype.onBackAction = function () {
        this.removeSelf();
      }),
      (t.prototype.onupdateRepairItemFn = function (e, t) {
        var r = e.dataSource;
        if (!(r.i > this.repairData.length)) {
          var i = e.getChildByName("label_repair_state"),
            a = e.getChildByName("btn_repari_state"),
            n = this.repairData[r.i];
          n.p == n.s
            ? ((i.text = "(已满)"), (a.visible = !1))
            : ((i.text = ""), (a.visible = !0));
        }
      }),
      (t.prototype.onLoadRepairListData = function (e) {
        if (0 == e.code) {
          var t = [],
            r = [],
            i = [];
          this.repairData = e.data;
          for (var a = 0; a < this.repairData.length; a++) {
            var n = this.repairData[a],
              o = {
                label_repair_name: { text: n.n + "  " + n.k },
                label_repair_pro: { text: n.p + "%" },
                i: a,
              };
            1 == n.t && t.push(o), 2 == n.t && r.push(o), 3 == n.t && i.push(o);
          }
          (this.list_one_repair.dataSource = t),
            r.length > 0
              ? ((this.label_two_trans.visible = !0),
                (this.list_two_repair.visible = !0))
              : ((this.label_two_trans.visible = !1),
                (this.list_two_repair.visible = !1)),
            (this.list_two_repair.dataSource = r),
            i.length > 0
              ? ((this.label_three_trans.visible = !0),
                (this.list_three_repair.visible = !0))
              : ((this.label_three_trans.visible = !1),
                (this.list_three_repair.visible = !1)),
            (this.list_three_repair.dataSource = i);
        } else ToastView.toastView(e.msg);
      }),
      (t.prototype.onListRepairPropertyAction = function (e) {
        if ("" != e.target.name && "btn_repari_state" == e.target.name) {
          var t = e.currentTarget.selectedItem,
            r = this.repairData[t.i],
            i = {
              type: this.jsonDict.type,
              roleType: r.r,
              cid: r.id,
              name: r.n,
              k: r.k,
              sid: r.sid,
              s: r.s,
            };
          RepairSkillDialog.showRepairDialog(i);
        }
      }),
      (t.prototype.dealRepairDot = function (e, t) {
        return Math.round((parseInt(e) / parseInt(t)) * 1e4) / 100 + "%";
      }),
      t
    );
  })(ui.SuboardinateController.RepairPropertyViewUI);
